Skip to content

Conversation

@InDebt
Copy link

@InDebt InDebt commented May 3, 2025

Generic Secondary resources

This PR will enable generic secondary resources that can be configured for each individual Sim UI to reflect their respective resource.

Right now it can be used like this for example (note. the extra variable for ShadowOrb is just for taste and more expressivnes in the spell later)
in shadow.go

spriest.RegisterSecondaryResourceBar(core.SecondaryResourceConfig{
    Type: core.ShadowOrbs,
    Max:  3,
})

spriest.ShadowOrbs = spriest.SecondaryResourceBar

in mind_blast.go

shadow.ShadowOrbs.Gain(1, spell.ActionID, sim)

With a simple configuration like

secondaryResource: {
    color: "#b8a8f0",
    icon: "https://wow.zamimg.com/images/wow/icons/large/spell_priest_shadoworbs.jpg",
    name: "Shadow Orb",
}

The UI will display the generic resource accordingly.

grafik
grafik

@InDebt InDebt requested a review from 1337LutZ May 3, 2025 13:51
@github-actions github-actions bot added the Priest label May 3, 2025
@InDebt
Copy link
Author

InDebt commented May 3, 2025

Looking into this - in theory we can add a new SecondaryResourceCost that would check for a certain secondary resource.
This resource has to be spent however, so spells that consume 'all' or 'UpTo' (i.E. 3 Holy Power) would either need a rework of the ApplyEffect method to supply the amount of resource used, or for those spells it needs to be done through the ExtraCondition and resources are spend in the ApplyEffect method.

This would be rather intransparent I feel. We can define a cost - but may only do so if the cost can not be spend before the ApplyEffect method. In my opinion it's easier and more transparent to simply define a ExtraCondition for all spells using a secondary resoruce and handle the appropiate spending logic within the spell.

Thoughts?

@1337LutZ
Copy link

1337LutZ commented May 3, 2025

This resource has to be spent however, so spells that consume 'all' or 'UpTo' (i.E. 3 Holy Power) would either need a rework of the ApplyEffect method to supply the amount of resource used, or for those spells it needs to be done through the ExtraCondition and resources are spend in the ApplyEffect method.

Yea I think I agree. Nerdegghead also mentioned it, as Spenders can have "variable" cost that can't be handled by SpellMods

@1337LutZ 1337LutZ requested a review from NerdEgghead May 3, 2025 18:54
@InDebt InDebt marked this pull request as ready for review May 4, 2025 16:44
Copy link

@NerdEgghead NerdEgghead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also recommend ripping out the custom Holy Power resource implementation and replacing it with the new general framework as part of this PR. Now that we'll have the general version, we shouldn't keep any custom resource bars in the code anymore unless there's a good reason for it.

@InDebt
Copy link
Author

InDebt commented May 5, 2025

Cleaned some parts up based on feedback here. Also replaced the holy power implementation to be based on the SecondaryResourceBar. Due to Divine Purpose I actually just implemented a light weight HolyPowerBar that implements the Divine Purpose logic.

After touching the Holy Power implementation though, I guess we also need to provider proper APL support.

@github-actions github-actions bot removed the Priest label May 5, 2025
@InDebt
Copy link
Author

InDebt commented May 5, 2025

With the Help of @1337LutZ APL support has been integrated now as well that dynamically resolves the resource name for the APL action.

grafik

Copy link

@NerdEgghead NerdEgghead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting closer!

@hillerstorm
Copy link

Cleaned some parts up based on feedback here. Also replaced the holy power implementation to be based on the SecondaryResourceBar. Due to Divine Purpose I actually just implemented a light weight HolyPowerBar that implements the Divine Purpose logic.

After touching the Holy Power implementation though, I guess we also need to provider proper APL support.

In my local pala branch I've actually cleaned up the DP proc logic a bit by having the holy power bar have a pub/sub for resource gain/spent, I can just do that on top of these changes later 🙂 seems like a useful thing

@hillerstorm
Copy link

Cleaned some parts up based on feedback here. Also replaced the holy power implementation to be based on the SecondaryResourceBar. Due to Divine Purpose I actually just implemented a light weight HolyPowerBar that implements the Divine Purpose logic.

After touching the Holy Power implementation though, I guess we also need to provider proper APL support.

In my local pala branch I've actually cleaned up the DP proc logic a bit by having the holy power bar have a pub/sub for resource gain/spent, I can just do that on top of these changes later 🙂 seems like a useful thing

And now I see you also added the pub/sub 😅 nice!

@InDebt
Copy link
Author

InDebt commented May 6, 2025

Alright - Chi is gone

Copy link

@NerdEgghead NerdEgghead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, just added one additional comment.

@InDebt InDebt merged commit e0ccf6a into master May 9, 2025
2 checks passed
@1337LutZ 1337LutZ deleted the feature/generic-resources branch December 6, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants